<style rel="stylesheet/scss" lang="scss" scoped >
.company {

  position: relative;
  height:107px;
  .company-row {
    overflow: hidden;
    width: 100%;
    clear: both;
    div {
      float: left;
    }
    &:last-child {
      margin-top: 5px;
    }
    .company-info {
      box-sizing: border-box;
      padding-right: 20px;
      padding-left: 20px;
      border-right: 1px solid #ebeef5;
      &:first-child {
        padding-left: 0px;
      }
      &:last-child {
        padding-right: 0px;
        border-right: 0;
      }
      .company-text {
        font-weight: 700;
        font-size: 13px;
        color: #cccccc;
      }
      .company-val {
        margin-left: 5px;
        font-size: 14px;
        text-align: left;
        color: #333333;
      }
    }
    .company-name {
      font-weight: 700;
      font-style: normal;
      font-size: 28px;
      color: #666666;
    }
    .company-setting {
      cursor: pointer;
      font-size: 10px;
      color: #386BD0;
      margin-left: 5px;
      position: absolute;
      right: 32px;
      top: 32px;
      font-size: 16px;
      background: #4080ff;
      color: #fff;
      padding: 10px 20px;
      border-radius: 5px;
    }
    .company-date {
      color: #cccccc;
      font-size: 22px;
      float: right;
    }
  }
}
</style>
<template>
  <el-card
    v-loading="isLoading"
    :body-style="{ height:'105px' }"
    class="company"
    shadow="never"
    element-loading-text="加载中..."
  >
    <div class="company-row">
      <div>
        <span class="company-name">{{ data.YH_GSMC ==='未知'?name:data.YH_GSMC }}</span>
        <span
          @click="handleCompany"
          class="company-setting"
        >企业信息设置</span>
      </div>
    </div>
    <div class="company-row">
      <div class="company-info">
        <span class="company-text">规模</span>
        <span class="company-val">{{ data.YH_GM || '未知' }}</span>
      </div>
      <!-- <div class="company-info">
        <span class="company-text">所在地区</span>
        <span class="company-val">{{data.companyAddress}}</span>
      </div> -->
      <div class="company-info">
        <span class="company-text">公司性质</span>
        <span class="company-val">{{ data.YH_GSXZ_NAME || '未知' }}</span>
      </div>
      <div class="company-info">
        <span class="company-text">联系人</span>
        <span class="company-val">{{ data.YH_LXR || '未知' }}</span>
      </div>
      <div class="company-info">
        <span class="company-text">联系电话</span>
        <span class="company-val">{{ data.YH_LXDH || '未知' }}</span>
      </div>
      <div class="company-info">
        <span class="company-text">联系邮箱</span>
        <span class="company-val">{{ data.YH_LXYX || '未知' }}</span>
      </div>
      <div class="company-info">
        <span class="company-text">税务登记证号</span>
        <span class="company-val">{{ data.YH_SWDJZH || '未知' }}</span>
      </div>
    </div>
  </el-card>
</template>
<script>
import { fetchCompanyInfoNew } from '../../actions/manage';

export default {
  name: 'Company',
  data() {
    return {
      data: {
        isLoading: true,
        name: '',
      },
    };
  },
  mounted() {
    this.getCompanyInfo();
  },
  methods: {
    handleCompany() {
      const that = this;
      JE.showFunc('JE_SAAS_YHINFO', {
        type: 'form',
        callback(panel) {
          // 监听窗口关闭
          const win = panel.up('window');
          win.on('close', () => {
            that.getCompanyInfo();
          });
        },
      });
    },
    getCompanyInfo() {
      this.isLoading = true;
      const user = Ext.clone(JE.USER);
      this.name = user.jtgsMc;
      const param = {
        tableCode: 'JE_SAAS_YH',
        pkValue: `${JE.currentUser.zhId}`,
      };
      fetchCompanyInfoNew(param).then((data) => {
        this.isLoading = false;
        this.data = data;
      });
    },
  },
};
</script>
